package org.jbch.shittim.utils;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper {


	public DBHelper(Context context) {
		super(context, "jbchShittimBroad.db", null, 1);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {

		String query = "CREATE TABLE shittimBroadInfo ("+
		"_id INTEGER PRIMARY KEY autoincrement,"+
		"title text,"+
		"mp3 varchar(150),"+
		"writer varchar(50),"+
		"description text,"+
		"hit INTEGER NOT NULL DEFAULT (0),"+
		"pubDate DATETIME DEFAULT (date('now')))";
		db.execSQL(query);
		
		
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

		
		if(oldVersion!=newVersion){
			String query = "DROP TABLE IF EXISTS jbchShittimBroad";
			db.execSQL(query);
			onCreate(db);
		}
		
		
		
	}
 
}
